﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Extjs_ReGSharp.Interfaces;

namespace Extjs_ReGSharp
{
	public class GridResult<T> where T : IGridDisplayItem
	{
		// This is a string field because of the ext js format
		public string totalCount { get; private set; }
		public List<object> topics { get; private set; }

		public GridResult(List<T> entities, int totalCountAfterFiltering)
		{
			totalCount = totalCountAfterFiltering.ToString();
			topics = entities.Select(gridItem => gridItem.ToDisplayDTO()).ToList();
		}
	}
}
